home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: division problem
- Date: Tue, 06 Feb 96 20:42:35 GMT
- Organization: none
- Message-ID: <823639355snz@genesis.demon.co.uk>
- References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk> <4emuba$1mo@fountain.mindlink.net> <823118692snz@genesis.demon.co.uk> <4eqm6q$bdk@airdmhor.gen.nz>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4eqm6q$bdk@airdmhor.gen.nz>
- gumboot@airdmhor.gen.nz "Simon Hosie" writes:
-
- >> Still no need to use floating point,
- >> celcius = ((fahrenheit - 32) * 5 + 4) / 9
- >
- >genew@mindlink.bc.ca "Gene Wirchenko" writes:
- >> Let's assume that you had never run across fahrenheit to celsius
- >> conversion before (because the above could just as easily be a case of
- >> converting flibbles to meeblesnauzers).
- >>
- >> Can you derive the ORIGINAL formula for conversion of F to C?
- >>
- >> If yes, how? Because you don't know what the 4 is for.
- >
- >Lawrence Kirby:
- >> Maybe not but its effect is clearly one of rounding. Perhaps it would be
- >> clearer to specify it as (9/2), perhaps not.
- >
- > It's not perfect rounding (you should have seen my examply by now).
-
- Yes, it is perfect rounding (at least for positive results but your version
- has similar problems for negative results). If you don't believe me
- try to find a case (with a positive result) where your expression
- generates a different result to mine.
-
- > And
- >you can get the original formula back as long as you know that you're
- >working with integers.
-
- As you can from mine.
-
- >genew@mindlink.bc.ca "Gene Wirchenko" writes:
- >> If no, then it's unclear code, isn't it?
- >
- >Lawrence Kirby:
- >> How would you express it more clearly?
- >
- > I'd just put a comment next to it if I thought it was necessary.
-
- Yes, but that doesn't answer the question of how you make the expression
- itself clearer.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-